package com.kun.product.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 
 * 
 * @author kun_er
 * @email 2661038743@qq.com
 * @date 2022-05-02 16:11:15
 */

@ToString
@TableName("product")
public class ProductEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 产品id
	 */
	@TableId(value="id",type= IdType.AUTO)
	private String id;
	/**
	 * 产品名称
	 */
	private String productName;
	/**
	 * 单位规格
	 */
	private String unit;
	/**
	 * 产品单价
	 */
	private BigDecimal unitPrice;
	/**
	 * 个数
	 */
	private Float nums;
	/**
	 * 总价
	 */
	private BigDecimal totalPrice;
	/**
	 * 进货日期
	 */
	@TableField(fill = FieldFill.INSERT)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date date;
	/**
	 * 分类id
	 */
	private String cid;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public BigDecimal getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(BigDecimal unitPrice) {
		this.unitPrice = unitPrice;
	}

	public Float getNums() {
		return nums;
	}

	public void setNums(Float nums) {
		this.nums = nums;
	}

	public BigDecimal getTotalPrice() {
		BigDecimal itemPrice = this.getUnitPrice().multiply(new BigDecimal(this.getNums().toString()));
		return itemPrice;
	}

	public void setTotalPrice(BigDecimal totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getCid() {
		return cid;
	}

	public void setCid(String cid) {
		this.cid = cid;
	}
}
